<?php

$themecolors = array(
	'bg' => 'ffffff',
	'text' => '000000',
	'link' => 'aa7d39'
	);

if ( function_exists('register_sidebars') ) register_sidebars(1);


add_action('admin_menu', 'fleur_gasy_add_theme_page');



function fleur_gasy_add_theme_page() {

	if ( $_GET['page'] == basename(__FILE__) ) {
	
	    // save settings
		if ( 'save' == $_REQUEST['action'] ) {

			update_option( 'fleur_gasy_sortpages', $_REQUEST[ 'sortpages' ] );

			header("Location: themes.php?page=functions.php&saved=true");
			die;

  		// reset settings
		} else if( 'reset' == $_REQUEST['action'] ) {

			delete_option( 'fleur_gasy_sortpages' );			

			// goto theme edit page
			header("Location: themes.php?page=functions.php&reset=true");
			die;

		}
	}


    add_theme_page("Theme Options", "Theme Options", 'edit_themes', basename(__FILE__), 'fleur_gasy_theme_page');

}


function fleur_gasy_theme_page() {

	// --------------------------
	// Fleurys theme page content
	// --------------------------

	if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong> Settings saved.</strong></p></div>';
	if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong> Settings reset.</strong></p></div>';
	
?>
<div class="wrap">
<h2>Fleur de lys Options</h2>

<div class="block">Option page added by : Heriniaina Eugene - hery@serasera.org - (<a href="http://serasera.org">serasera.org</a>)</div>


<form method="post">


<!-- blog layout options -->
<fieldset class="options">
<table width="100%" cellspacing="5" cellpadding="10" class="editform">
<tr valign="top">
<td align="left">
<h4>List Pages / Navigation</h4>
<strong> Sort the List Pages by :</strong>
<select name="sortpages">
<option value=""></option>
<option value="post_title" <?php if(get_settings('fleur_gasy_sortpages') == "post_title") echo "selected"; ?>>Page title</option>
<option value="post_date" <?php if(get_settings('fleur_gasy_sortpages') == "post_date") echo "selected"; ?>>Page date</option>
<option value="menu_order" <?php if(get_settings('fleur_gasy_sortpages') == "menu_order") echo "selected"; ?>>Page order</option>

</td>
</tr>
<tr>
<td valign="top" style="border:0px;margin:0;padding:0;">
	<input type="hidden" name="action" value="save" />
	<input type="submit" name="save" value="Save Settings" />

</td>
</tr>
</table>
</fieldset>
</form>

</div>
<?php
}
?>
